<?php
/**
 *
 *
 */
namespace app\admin\controller;

use think\Controller;
use think\Db;
class Cate extends Common
{
    public function index()
    {
        return view();
    }
    public function add()
    {
        return view();
    }
    public function edit()
    {
    	$id = input('id');
        $this->assign('id', $id);
        return view();
    }
    //添加
    public function insert()
    {
        $data = $this->request->post();
        $data['time'] = time();
        if (!Db::name('cate')->strict(false)->data($data)->insert()) {
            $this->error('添加失败');
        } else {
            $this->success('添加成功');
        }
    }
    //更新栏目
    public function update()
    {
        $id = input('id');
        $data = $this->request->post();
        $data['time'] = time();
        if (Db::name('cate')->where('id', $id)->strict(false)->data($data)->update($data)) {
            $this->success('更新成功');
        } else {
            $this->error('更新失败');
        }
    }

    
}